<template>
	<div>
		<el-card>
			<el-input v-model.number="room" placeholder="请输入四位数字"></el-input>
			<el-button type="primary" @click="getIndexData" v-preventReClick="10000"> 查询 </el-button>
			<div id="main" style="width: 800px; height: 500px; margin: 10px auto">
				<el-table :data="tableData" style="width: 100%">
					<el-table-column prop="name" label="名字" width="180"> </el-table-column>
					<el-table-column prop="sex" label="性别" width="180"> </el-table-column>
					<el-table-column prop="number" label="工号"> </el-table-column>
					<el-table-column prop="department" label="部门"> </el-table-column>
				</el-table>
			</div>
		</el-card>
	</div>
</template>
<script>
export default {
  data () {
    return {
      room: 5401,
      tableData: []
    }
  },
  created () {

  },
  mounted () {

  },
  methods: {
    // 得到数据
    async getIndexData () {
      const result = await this.$ajax.get('/lookroombyno', {
        params: {
          room: this.room
        }
      })
      console.log(result.data)
      const { code, data } = result.data
      console.log(code)
      if (code === '0') {
        this.tableData = data
      }
    }
  }
}
</script>
<style scoped>
.body {
}
</style>
